<!DOCTYPE html>
<HTML>
<HEAD><meta name="viewport" content="width=device-width, initial-scale=1">
<Title>XYChart.packPlotArea</Title>
<link type='text/css' rel='Stylesheet' href="maxchartapi.css" />
</HEAD>
<body bgcolor="#FFFFFF" text="#000000" topmargin="0" leftmargin="0" rightmargin="0" marginwidth="0" marginheight="0">

<p class="heading0">ChartDirector 7.0 (Java Edition)</p>
<p class="heading1"><a href="XYChart.htm">XYChart</a>.<wbr>packPlotArea</p>
<hr class="separator">
<p class="heading2a">Usage</p>
<div class="content">
public void packPlotArea(int leftX, int topY, int rightX, int bottomY [, int minWidth [, int minHeight ]])
</div>
<p class="heading2">Description</p>
<div class="content">
Adjusts the plot area size and position to fit the plot area and the axis labels in a bounding box.<br><br>
In some charts, the axis labels may vary widely and can be very short or very long. It may be difficult to determine to plot area position and size so as to reserve reasonable and sufficient space for the axis labels.<br><br>
This method adjusts the size and position of the plot area, so that the plot area, together with the axis labels can fit within a given bounding box.<br><br>
Note that this method only adjusts for the thickness of the primary and secondary axes, and assumes they are at the border of the plot area. For other axes, you may use <a href="Axis.getThickness.htm">Axis.getThickness</a> to get their thickness and adjust the plot area size and position accordingly.<br><br>
For this method to determine the thickness of the axes, it needs to auto-scale the axes to determine the axis labels. That means all the data should be entered to the chart before calling this method.<br><br>
Furthermore, the labels generated by auto-scaling depend on the number of labels that can fit on the axis, which in turn depends on the plot area size. So even the final plot area size is determined by this method, the <a href="XYChart.setPlotArea.htm">XYChart.setPlotArea</a> must still be used to set a reasonable initial plot area size.<br><br>
To adjust only the plot area width and horizontal position, and leave the height and vertical position unchanged, simply use a bounding box with zero height (eg. set both <b>topY</b> and <b>bottomY</b> to 0). Similarly, to adjust only the height and vertical position, use a bounding box with zero width.<br><br>
In some extreme cases, the axis labels may be so long that the plot area needs to adjust to an unreasonably small size, or even zero in size. For example, the axis labels may be names entered by the user, and the user may enter a name thousands of characters long. These extreme cases should be avoided by checking and limiting the length of the labels before passing the labels to ChartDirector. This method also has a safeguard for these unreasonable labels by ensuring the plot area will not shrink below a given minimum size.
</div>
<p class="heading2">Arguments</p>
<div class="content">
<div style="width:100%;box-sizing:border-box;">
<table border="1" cellpadding="5" cellspacing="0" width="100%"> 
<tr>
<th width="19%">Argument</th><th width="19%">Default</th><th>Description</th>
</tr>
<tr>
<td>leftX</td><td>(Mandatory)</td><td>The left x coordinate of the bounding box.</td></tr><tr><td>topY</td><td>(Mandatory)</td><td>The top y coordinate of the bounding box.</td></tr><tr><td>rightX</td><td>(Mandatory)</td><td>The right x coordinate of the bounding box.</td></tr><tr><td>bottomY</td><td>(Mandatory)</td><td>The bottom y coordinate of the bounding box.</td></tr><tr><td>minWidth</td><td>0</td><td>The minimum width the plot area can adjust to.</td></tr><tr><td>minHeight</td><td>0</td><td>The minimum height the plot area can adjust to.</td>
</tr>
</table>
</div>
</div>
<p class="heading2">Return Value</p>
<div class="content">
None
</div>
<br><hr class="separator">
<div class="copyright">&copy; 2022 Advanced Software Engineering Limited. All rights reserved.</div>
</body>
</HTML>
